package app.mvc.view.components.controls
{
	import alternativa.gui.base.GUIobject;
	import alternativa.gui.controls.button.BaseButton;
	import alternativa.gui.theme.defaulttheme.controls.buttons.Button;
	import alternativa.gui.theme.defaulttheme.controls.text.Label;
	
	import app.mvc.model.VO.ControlsBarVO;
	import app.mvc.model.VO.UIObjectVO;
	
	import flash.display.Bitmap;
	
	import globals.Config;
	import globals.Global;
	
	import utils.Reflection;
	import utils.UtilsGraphics;
	
	/**
	 * 控件面板上的各种小控件图标,可用来拖放
	 * @author XiLing
	 */
	public class BaseDragableControls extends Button
	{
		private var prototypeObj:GUIobject;
		public function BaseDragableControls()
		{
			super();
		}
		
		public function set model($item:UIObjectVO):void
		{
			prototypeObj = Reflection.createDisplayObjectInstance($item.classString) as GUIobject;
			
			if(prototypeObj.hasOwnProperty("text"))
				prototypeObj["text"] = $item.name;
			
			
			prototypeObj.resize(20,20);
			prototypeObj.drawChildren();
			prototypeObj.freezeHeight= true;
			prototypeObj.freezeWidth = true;
			
			this.padding=0;
			
			this.icon = new Bitmap(UtilsGraphics.getSnapShot(prototypeObj));
			
			this.width = 30;
			this.height = 30;
			this.freezeHeight = true;
			this.freezeWidth=true;
		}
	}
}